| Server IP : 54.216.143.184 / Your IP : 172.31.22.179 Web Server : Apache/2.4.68 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2 System : Linux ip-172-31-10-208.eu-west-1.compute.internal 6.8.0-1044-aws #46~22.04.1-Ubuntu SMP Tue Dec 2 12:52:18 UTC 2025 x86_64 User : kazang ( 1006) PHP Version : 8.2.31 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/kazang/web/kazang.com/public_html/wp-content/themes/understrap/inc/ |
Upload File : |
<?php
/**
* Block editor (gutenberg) specific functionality
*
* @package Understrap
* @since 1.0.0
*/
add_action( 'after_setup_theme', 'understrap_block_editor_setup' );
if ( ! function_exists( 'understrap_block_editor_setup' ) ) {
/**
* Sets up our default theme support for the WordPress block editor.
*
* @since 1.0.0
*/
function understrap_block_editor_setup() {
// Add support for the block editor stylesheet.
add_theme_support( 'editor-styles' );
// Add support for wide alignment.
add_theme_support( 'align-wide' );
// Register our custom colors as options in the editor.
$color_palette = understrap_generate_color_palette();
if ( $color_palette ) {
add_theme_support( 'editor-color-palette', $color_palette );
}
}
}
if ( ! function_exists( 'understrap_generate_color_palette' ) ) {
/**
* Checks for our JSON file of color values. If exists, creates a color palette array.
*
* @since 1.0.0
*
* @return array
*/
function understrap_generate_color_palette() {
$color_palette = array();
// Grabs the autogenerated color palette that we're pulling from our compiled bootstrap stylesheets.
$file_path = get_theme_file_path( '/inc/editor-color-palette.json' );
if ( 'bootstrap4' === get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' ) ) {
$file_path = get_theme_file_path( '/inc/editor-color-palette-bootstrap4.json' );
}
$color_palette_json = file_get_contents( $file_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
if ( $color_palette_json ) {
$color_palette_json = json_decode( $color_palette_json, true );
if ( is_array( $color_palette_json ) ) {
foreach ( $color_palette_json as $key => $value ) {
if ( ! is_string( $key ) ) {
continue;
}
$key = str_replace( array( '--bs-', '--' ), '', $key );
$color_palette[] = array(
'name' => $key,
'slug' => $key,
'color' => $value,
);
}
}
}
/**
* Filters the default bootstrap color palette so it can be overridden by child themes or plugins when we add theme support for editor-color-palette.
*
* @since 1.0.0
*
* @param array $color_palette An array of color options for the editor-color-palette setting.
*/
return apply_filters( 'understrap_theme_editor_color_palette', $color_palette );
}
}